package sm.dbdict.def;

public class Field implements Cloneable {
	private String name;

	private Integer level;

	private Integer index;

	private Integer type;

	private String structure;

	private String db2_field_name;

	private Integer db2_length;

	private SqlFieldOptions sql_field_options;

	private StructureArrayOptions structure_array_options;

	private FieldCheckCode fieldCheckCode;

	private Field parentField;

	public Field getParentField() {
		return parentField;
	}

	public void setParentField(Field parentField) {
		this.parentField = parentField;
	}

	public FieldCheckCode getFieldCheckCode() {
		return fieldCheckCode;
	}

	public void setFieldCheckCode(FieldCheckCode fieldCheckCode) {
		this.fieldCheckCode = fieldCheckCode;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public Integer getLevel() {
		return level;
	}

	public void setLevel(Integer level) {
		this.level = level;
	}

	public Integer getIndex() {
		return index;
	}

	public void setIndex(Integer index) {
		this.index = index;
	}

	public Integer getType() {
		return type;
	}

	public void setType(Integer type) {
		this.type = type;
	}

	public String getStructure() {
		return structure;
	}

	public void setStructure(String structure) {
		this.structure = structure;
	}

	public String getDb2_field_name() {
		return db2_field_name;
	}

	public void setDb2_field_name(String db2_field_name) {
		this.db2_field_name = db2_field_name;
	}

	public Integer getDb2_length() {
		return db2_length;
	}

	public void setDb2_length(Integer db2_length) {
		this.db2_length = db2_length;
	}

	public SqlFieldOptions getSql_field_options() {
		return sql_field_options;
	}

	public void setSql_field_options(SqlFieldOptions sql_field_options) {
		this.sql_field_options = sql_field_options;
	}

	public StructureArrayOptions getStructure_array_options() {
		return structure_array_options;
	}

	public void setStructure_array_options(
			StructureArrayOptions structure_array_options) {
		this.structure_array_options = structure_array_options;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result
				+ ((db2_field_name == null) ? 0 : db2_field_name.hashCode());
		result = prime * result
				+ ((db2_length == null) ? 0 : db2_length.hashCode());
		result = prime * result + ((index == null) ? 0 : index.hashCode());
		result = prime * result + ((level == null) ? 0 : level.hashCode());
		result = prime * result + ((name == null) ? 0 : name.hashCode());
		result = prime * result
				+ ((parentField == null) ? 0 : parentField.hashCode());
		result = prime
				* result
				+ ((sql_field_options == null) ? 0 : sql_field_options
						.hashCode());
		result = prime * result
				+ ((structure == null) ? 0 : structure.hashCode());
		result = prime
				* result
				+ ((structure_array_options == null) ? 0
						: structure_array_options.hashCode());
		result = prime * result + ((type == null) ? 0 : type.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Field other = (Field) obj;
		if (db2_field_name == null) {
			if (other.db2_field_name != null)
				return false;
		} else if (!db2_field_name.equals(other.db2_field_name))
			return false;
		if (db2_length == null) {
			if (other.db2_length != null)
				return false;
		} else if (!db2_length.equals(other.db2_length))
			return false;
		if (index == null) {
			if (other.index != null)
				return false;
		} else if (!index.equals(other.index))
			return false;
		if (level == null) {
			if (other.level != null)
				return false;
		} else if (!level.equals(other.level))
			return false;
		if (name == null) {
			if (other.name != null)
				return false;
		} else if (!name.equals(other.name))
			return false;
		if (parentField == null) {
			if (other.parentField != null)
				return false;
		} else if (!parentField.equals(other.parentField))
			return false;
		if (sql_field_options == null) {
			if (other.sql_field_options != null)
				return false;
		} else if (!sql_field_options.equals(other.sql_field_options))
			return false;
		if (structure == null) {
			if (other.structure != null)
				return false;
		} else if (!structure.equals(other.structure))
			return false;
		if (structure_array_options == null) {
			if (other.structure_array_options != null)
				return false;
		} else if (!structure_array_options
				.equals(other.structure_array_options))
			return false;
		if (type == null) {
			if (other.type != null)
				return false;
		} else if (!type.equals(other.type))
			return false;
		return true;
	}

	@Override
	public Object clone() {
		try {
			Field clonedObj = (Field) super.clone();
			clonedObj.db2_field_name = db2_field_name;
			clonedObj.db2_length = db2_length;
			clonedObj.index = index;
			clonedObj.level = level;
			clonedObj.name = name;
			clonedObj.sql_field_options = (SqlFieldOptions) sql_field_options
					.clone();
			clonedObj.structure = structure;
			clonedObj.structure_array_options = (StructureArrayOptions) structure_array_options
					.clone();
			clonedObj.type = type;
			return clonedObj;
		} catch (CloneNotSupportedException e) {
			// this shouldn't happen, since we are Cloneable
			throw new InternalError();
		}
	}
}
